//
//  MyWebViewController.m
//  OneWordNew
//
//  Created by qianfeng on 15-7-4.
//  Copyright (c) 2015年 朱共营. All rights reserved.
//

#import "MyWebViewController.h"
#import <WebKit/WebKit.h>
#import "PinLunViewController.h"
@interface MyWebViewController ()<UIWebViewDelegate>
{
    UIWebView *_webView;

}
@property(nonatomic) UIView *imageView;
@property(nonatomic) UIWebView *webView;
@end

@implementation MyWebViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    NSLog(@"%@",self.idd);
    [self creatUI];
   // [self creatimageView];
}
- (void)creatUI{
    [self creatBarButton];
    _webView=[[UIWebView alloc] initWithFrame:CGRectMake(0, -45, kScreenSize.width, kScreenSize.height+40)];
    _webView.delegate=self;
    _webView.scalesPageToFit=YES;
    
    NSURLRequest *request=[NSURLRequest requestWithURL:[NSURL URLWithString:self.webUrl]];
    [self.webView loadRequest:request];
    _webView.scrollView.bounces=NO;
    [self.view addSubview:self.webView];

}
- (void)creatBarButton{
//    UIBarButtonItem *comment=[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"comment_11"] style:UIBarButtonItemStylePlain target:self action:@selector(commentClick:)];
//    UIBarButtonItem *share=[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"share_11"] style:UIBarButtonItemStylePlain target:self action:@selector(btnClick:)];
    
//    UIBarButtonItem *back=[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemReply target:self action:@selector(btnClick:)];
    UIBarButtonItem *home=[[UIBarButtonItem alloc] initWithTitle:@"首页" style:UIBarButtonItemStyleDone target:self action:@selector(homeClick:)];
    UIBarButtonItem *comment=[[UIBarButtonItem alloc] initWithTitle:@"评论" style:UIBarButtonItemStylePlain target:self action:@selector(commentClick:)];
    self.navigationItem.rightBarButtonItem=comment;
    self.navigationItem.leftBarButtonItem=home;

}
- (void)commentClick:(UIBarButtonItem *)bar{
    PinLunViewController *pinlun=[[PinLunViewController alloc] init];
    pinlun.userId=self.idd;
    [self.navigationController pushViewController:pinlun animated:YES];


}
- (void)homeClick:(UIBarButtonItem *)btn{
    [self.navigationController popViewControllerAnimated:YES];

}
- (void)btnClick:(UIBarButtonItem *)btn{
    // [self shareData];
    [_webView goBack];
}
- (void)shareData{
    


}
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.tabBarController.tabBar.hidden=YES;
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

//-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
//{
//    return YES;
//}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
